<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Real Property and Business Permit</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
</head>
<body>
<div id="bg">
<div id="logo">
<img src="images/logo_and_name.png" alt="" width="305" height="78" />
</div>
<div id="main">

 
<!-- content begins -->
<div id="content_bg">
 
    <div class="TPName" id="TPName">
    <left><h2>Transfer Ownership</h2></left>
    <p>
    <?php 
		$x=$_GET['TPID']; 
		$db_name = "thesis_bis";
	$table_name = "taxpayer";

	$user = "root";
	$pass = "";
	
	$connection = mysql_connect("localhost","$user","$pass")
	or die(mysql_error());

	$db = mysql_select_db($db_name, $connection) or die(mysql_error());

	$sql = "SELECT * FROM $table_name where TPID = '$x' ";

	$result = mysql_query($sql, $connection) or die(mysql_error());

	$num= mysql_num_rows($result);
   
    if($num<1)
	{
		$display_block = "<p><em>Empty...</em> </p>";
	}
	else
	{
	$number=0;
	while ($row = mysql_fetch_array($result))

	{   
	 
		$number++;
		$TPID = $row['TPID'];
		$TaxpayerLN=$row['TaxpayerLN'];
		$TaxpayerFN=$row['TaxpayerFN'];
		$TaxpayerMN=$row['TaxpayerMN'];
		
		
    }
	}
    ?>
    </p>
  
  <table width="400" height="200" border="1" align="left" class="table1">
          <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
        <input type="hidden" name="TPID" id="TPIDtext" value="<?php echo $TPID; ?>">
        <tr><th>
        
        </th>
        <th>
        <font color="#000000"><strong>Current Information</strong></font></th>
        <th>
        <font color="#000000"><strong>Enter New Information</strong></font></th>
        </tr>
          <tr>
            <th class="table1" width="153">Business Owner:</th>
            <td class="table1" width="176">
            <td class="table1" width="253">
              <label>
                </label></td>
          </tr>
          
          <tr>
            <td class="table1" >Last Name:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$TaxpayerLN"; ?></strong></font></td>
            <td class="table1"><input type="text" name="TaxpayerLN" id="textfield2" value="<?php echo "$TaxpayerLN"; ?>"></td>
          </tr>
          
          <tr>
            <td class="table1" >First Name:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$TaxpayerFN"; ?></strong></font></td>
            <td class="table1"><input type="text" name="TaxpayerFN" id="textfield2" value="<?php echo "$TaxpayerFN"; ?>"></td>
          </tr>
          
          <tr>
            <td class="table1" >Middle Name:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$TaxpayerMN"; ?></strong></font></td>
            <td class="table1"><input type="text" name="TaxpayerMN" id="textfield2" value="<?php echo "$TaxpayerMN"; ?>"></td>
          </tr>
          
          <td>&nbsp;</td>
            <td><input type="hidden" name="id" value="<?php echo $_GET['TPID'];?>"></td>
            <td><label>        
            <input name="btn_submit2" type="submit" class="icon" id="button" onClick="return validate()" value="Submit">
            </label></td>
          </tr>  
          </form>  
      </table>
      
      <?php
		
		if(isset($_POST['btn_submit2']))
		   {

	
	$db_name = "thesis_bis";
	$table_name = "taxpayer";
	$user = "root";
	$pass = "";
	$connection = mysql_connect("localhost","$user","$pass")
	or die(mysql_error());
	$db = mysql_select_db($db_name, $connection) or die(mysql_error());
	
	$sql = "UPDATE $table_name SET TaxpayerLN = '$_POST[TaxpayerLN]',TaxpayerFN = '$_POST[TaxpayerFN]', TaxpayerMN = '$_POST[TaxpayerMN]' WHERE TPID = '$_POST[TPID]'";
	
	$result = mysql_query($sql, $connection) or die(mysql_error());
	echo "TAXPAYER SUCCESSFULLY UPDATED!";
	
}
?>

    </div>

</div>

<a href="#" class="stylea" style="text-decoration:none" onClick="window.close('#','popup','width=900,height=550,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=300,top=50'); return false"></a>
<!-- content ends -->
<!-- footer begins -->
<div id="footer">
   <a href="http://validator.w3.org/check?uri=referer">Copyrights © 2012</a> | <a href="http://guinobatan.gov.ph/index.php/guinobatan/index">Municipality of Guinobatan</a>. | All rights reserved. 
      </p></div>
<!-- footer ends -->
</div>
</div>
</body>
</html>